# Python11 新特性

# 结构模型匹配
a={10,20,50} #集合不行
data = eval(input("请输入要匹配的内容:"))
match data:
    case {'name':'wez','age':20}:
        print('字典')
    case [10,20,30]:
        print('列表')
    case (10,20,40):
        print('元组')
    case _:
        print('啥也不是')

print('=============================================')

# 合并字典
d1={'a':10,'b':20}
d2={'c':30,'d':40,'e':50}
merged_dict=d1|d2
print(merged_dict)

print('=============================================')

# 同步迭代
fruits={'apple','orange','pear','grape'} #集合无序，列表有序
counts=[10,3,4,5]
for f,c in zip(fruits,counts): #两个一起遍历
    match f,c:
        case 'apple',10:
            print('10个苹果')
        case 'orange',3:
            print('3个桔子')
        case 'pear',4:
            print('4个梨')
        case 'grape',5:
            print('5串葡萄')


